import time
from machine import Pin, PWM

class PowerSound:
    tone_list = [262, 294,330, 350, 393, 441, 495]
    def __init__(self, soundPin):
        self.pos_buzzer = PWM(Pin(soundPin, Pin.OUT))
        self.pos_buzzer.duty(0)
        
    def playTone(self, num):
        self.pos_buzzer.duty(900)
        if num:
            self.pos_buzzer.freq(self.tone_list[num-1])
            time.sleep_ms(500)
            self.pos_buzzer.duty(0)
            time.sleep_ms(10)
        else:
            self.pos_buzzer.duty(0)
            time.sleep_ms(500)  
    def playToneList(self, numList):
        for i in numList:
            self.playTone(i)
        self.pos_buzzer.duty(0)
 



 

